import 'package:dodoclub/routes/routes.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'DoDo Club',
      debugShowCheckedModeBanner: false,
      //止字体大小跟随系统字体改变大小
      builder: EasyLoading.init(
        builder: (context, widget) {
          // return MediaQuery(
          //   data: MediaQuery.of(context)
          //       .copyWith(textScaler: const TextScaler.linear(1.0)),
          //   child: widget!,
          // );
          return MediaQuery(
            data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
            child: widget!,
          );
        },
      ),
      theme: ThemeData(
        // This is the theme of your application.
        //
        // TRY THIS: Try running your application with "flutter run". You'll see
        // the application has a purple toolbar. Then, without quitting the app,
        // try changing the seedColor in the colorScheme below to Colors.green
        // and then invoke "hot reload" (save your changes or press the "hot
        // reload" button in a Flutter-supported IDE, or press "r" if you used
        // the command line to start the app).
        //
        // Notice that the counter didn't reset back to zero; the application
        // state is not lost during the reload. To reset the state, use hot
        // restart instead.
        //
        // This works for code too, not just values: Most code changes can be
        // tested with just a hot reload.
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ).copyWith(
        colorScheme: const ColorScheme(
          brightness: Brightness.light,
          primary: Color(0xff7de93b),
          onPrimary: Color(0xFFFFFFFF),
          primaryContainer: Color(0xFFFFFFFF),
          onPrimaryContainer: Color(0xFF21005D),
          secondary: Color(0xFF625B71),
          onSecondary: Color(0xFFFFFFFF),
          secondaryContainer: Color.fromARGB(255, 222, 223, 255),
          onSecondaryContainer: Color(0xFF1D192B),
          tertiary: Color(0xFF7D5260),
          onTertiary: Color(0xFFFFFFFF),
          tertiaryContainer: Color(0xFFFFD8E4),
          onTertiaryContainer: Color(0xFF31111D),
          error: Color(0xFFB3261E),
          onError: Color(0xFFFFFFFF),
          errorContainer: Color(0xFFF9DEDC),
          onErrorContainer: Color(0xFF410E0B),
          background: Color(0xFFFFFBFE),
          onBackground: Color(0xFF1C1B1F),
          surface: Color(0xFFFFFBFE),
          onSurface: Color(0xFF1C1B1F),
          // surfaceVariant: Color(0xFFE7E0EC),
          onSurfaceVariant: Color(0xFF49454F),
          outline: Color(0xFF79747E),
          outlineVariant: Color(0xFFCAC4D0),
          shadow: Color(0xFF000000),
          scrim: Color(0xFF000000),
          inverseSurface: Color(0xFF313033),
          onInverseSurface: Color(0xFFf1f0f5),
          inversePrimary: Color(0xFFD0BCFF),
          // The surfaceTint color is set to the same color as the primary.
          surfaceTint: Color(0xFF6750A4),
        ),
        primaryColor: const Color(0xff7de93b),
        scaffoldBackgroundColor:
            const Color(0xfff1f2f3), //0xffededed //0xfff1f2f3
        // textTheme: const TextTheme(
        //   bodyMedium: TextStyle(color: Colors.black),
        //   headlineMedium: TextStyle(color: Colors.black),
        // ),
        appBarTheme: const AppBarTheme(
          scrolledUnderElevation: 0.0,
          backgroundColor: Color(0xFFFFFFFF),
          // foregroundColor: Color(0xFF1C1B1F),
          elevation: 0,
          // systemOverlayStyle: SystemUiOverlayStyle.light,
          iconTheme: IconThemeData(
            color: Colors.black,
          ),
        ),
        elevatedButtonTheme: ElevatedButtonThemeData(
          style: ElevatedButton.styleFrom(
            backgroundColor: const Color.fromARGB(255, 236, 237, 252),
            // minimumSize: Size(1, 45),
            // textStyle: TextStyle(fontSize: 33.0),
          ),
        ),
      ),
      // home: const MyHomePage(title: 'Flutter Demo Home Page'),
      initialRoute: "/main/main",
      defaultTransition: Transition.rightToLeft,
      getPages: AppRoute.pages,
    );
  }
}
